package org.hgvc.webapp.ets.jsf.beans.partner;

import java.util.Date;

import org.hgvc.webapp.ets.bo.PartnerProduct;
import org.hgvc.webapp.ets.spring.service.MemberService;
import org.jocsb.base.AbstractBean;
import org.jocsb.base.exception.BaseException;

public class PartnerInventoryBean extends AbstractBean{
	public static final String BEAN_NAME="partnerInventoryBean";
	public static final String NAV="partnerInventoryBean";
	public int noRoom = 0;
	public Date fromDate;
	public Date toDate;
	
	public MemberService memberService;
	private PartnerProduct partnerProduct;
	
	public String incAction() throws Exception{
		try {
			memberService.saveInventory(partnerProduct, fromDate, toDate, noRoom, "+", getThisUser());
		} catch (BaseException e) {
			initErrorBean(e);
			return NAV;
		}
		return PartnerProductMgtBean.NAV_LIST_PRODUCT;
	}
	
	public String decAction() throws Exception{
		try {
			memberService.saveInventory(partnerProduct, fromDate, toDate, noRoom, "-", getThisUser());
		} catch (BaseException e) {
			initErrorBean(e);
			return NAV;
		}
		return PartnerProductMgtBean.NAV_LIST_PRODUCT;
	}
	
	public PartnerProduct getPartnerProduct() {
		return partnerProduct;
	}

	public void setPartnerProduct(PartnerProduct partnerProduct) {
		this.partnerProduct = partnerProduct;
	}

	public PartnerInventoryBean() {
	}
	
	public MemberService getMemberService() {
		return memberService;
	}

	public void setMemberService(MemberService memberService) {
		this.memberService = memberService;
	}

	public int getNoRoom() {
		return noRoom;
	}

	public void setNoRoom(int noRoom) {
		this.noRoom = noRoom;
	}

	public Date getFromDate() {
		return fromDate;
	}

	public void setFromDate(Date fromDate) {
		this.fromDate = fromDate;
	}

	public Date getToDate() {
		return toDate;
	}

	public void setToDate(Date toDate) {
		this.toDate = toDate;
	}

}
